<?php
/**
* @version		$Id:products.php 1 2013-10-12 13:59:21Z  $
* @package		Cashbag
* @subpackage 	Tables
* @copyright	Copyright (C) 2013, . All rights reserved.
* @license #
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');

 
class CashbagViewProducts  extends JViewLegacy {

	public function display($tpl = null) 
	{
		$app    = &JFactory::getApplication();
                
                $task   = $app->input->get('task');
                $model  = new CashbagModelProducts();
                
                switch($task){
                    case'checkref':
                    {
                        $return['data']= $model->checkRef();
                        echo json_encode($return);
                        break;
                    }
                    case 'saveprod':
                    {
                        $return['data']= $model->saveProduct();
                        echo json_encode($return);
                        break;
                    }
                    case 'end_reception':
                    {
                        $return = $model->endReception();
						echo json_encode($return);
                        break;
                    }
                    case'list_price':
                    {
                        $data= $model->list_price();
                        //var_dump('');die($data);
                         echo json_encode($data);
                        break;
                    }
                    case'list_marque':
                    {
                        $data= $model->list_marque();
                         echo json_encode($data);
                        break;
                    }
                   
                }
		
		
	}
	
	/**
	 *  Displays the form
 	 * @param string $tpl   
     */
}	
?>